<?php

/**
 * This is the model class for table "jumlahdombakambing".
 *
 * The followings are the available columns in table 'jumlahdombakambing':
 * @property integer $jdk_id
 * @property integer $jdk_kec
 * @property integer $jdk_domba_jantan
 * @property integer $jdk_domba_betina
 * @property integer $jdk_kambing_jantan
 * @property integer $jdk_kambing_betina
 * @property integer $jdk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jdkKec
 */
class Jumlahdombakambing extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahdombakambing the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahdombakambing';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jdk_kec, jdk_domba_jantan, jdk_domba_betina, jdk_kambing_jantan, jdk_kambing_betina, jdk_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jdk_id, jdk_kec, jdk_domba_jantan, jdk_domba_betina, jdk_kambing_jantan, jdk_kambing_betina, jdk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jdkKec' => array(self::BELONGS_TO, 'Kecamatan', 'jdk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jdk_id' => 'Jdk',
			'jdk_kec' => 'Jdk Kec',
			'jdk_domba_jantan' => 'Domba Jantan',
			'jdk_domba_betina' => 'Domba Betina',
			'jdk_kambing_jantan' => 'Kambing Jantan',
			'jdk_kambing_betina' => 'Kambing Betina',
			'jdk_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jdk_id',$this->jdk_id);
		$criteria->compare('jdk_kec',$this->jdk_kec);
		$criteria->compare('jdk_domba_jantan',$this->jdk_domba_jantan);
		$criteria->compare('jdk_domba_betina',$this->jdk_domba_betina);
		$criteria->compare('jdk_kambing_jantan',$this->jdk_kambing_jantan);
		$criteria->compare('jdk_kambing_betina',$this->jdk_kambing_betina);
		$criteria->compare('jdk_tahun',$this->jdk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}